import { defineStore } from 'pinia'
import piniaStore from '@/store/index'

export const useAppStore = defineStore('app', {
  state: () => ({
    locale: localStorage.getItem('locale') || 'zh',
  }),
  getters: {},
  actions: {
    setLocale(lang: string) {
      this.locale = lang
      localStorage.setItem('locale', lang)
    },
  },
})

export function useAppOutSideStore() {
  return useAppStore(piniaStore)
}
